# -*- coding:utf-8 -*-
import httplib, urllib, json
 
#定义需要进行发送的数据   
#定义一些文件头   
headers = {"Content-Type":"application/x-www-form-urlencoded",   
                   "Connection":"Keep-Alive","Referer":"http://127.0.0.1/"};   
#与网站构建一个连接   
conn = httplib.HTTPConnection("127.0.0.1", 8080);   
myurl = '/jiong'
#开始进行数据提交   同时也可以使用get进行   
like_item = {}
like_item['type'] = 'like_jiong'
like_item['id'] = 1
like_item['code'] = '54ix6K+t56e75Yqo5byA5Y+R6ICFOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
params = urllib.urlencode(like_item); 
conn.request(method="POST", url=myurl, body=params, headers=headers);
#返回处理后的数据   
response = conn.getresponse(); 
#判断是否提交成功   
print response.status
print json.dumps(json.loads(response.read()), indent = 4)

hate_item = {}
hate_item['type'] = 'hate_jiong'
hate_item['id'] = 1
hate_item['code'] = '54ix6K+t56e75Yqo5byA5Y+R6ICFOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
params = urllib.urlencode(hate_item); 
conn.request(method="POST", url=myurl, body=params, headers=headers);
#返回处理后的数据   
response = conn.getresponse(); 
#判断是否提交成功   
print response.status
print json.dumps(json.loads(response.read()), indent = 4)

ding_item = {}
ding_item['type'] = 'ding_cmt'
ding_item['id'] = 1
ding_item['cmt_id'] = 31
ding_item['cmt_uid'] = 2
ding_item['cmt'] = '妹子，我每次2小时~~'
ding_item['code'] = '54ix6K+t56e75Yqo5byA5Y+R6ICFOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
params = urllib.urlencode(ding_item); 
conn.request(method="POST", url=myurl, body=params, headers=headers);
#返回处理后的数据   
response = conn.getresponse(); 
#判断是否提交成功   
print response.status
print json.dumps(json.loads(response.read()), indent = 4)

cmt_item = {}
cmt_item['reply'] = '撸出个未来aaaaaabbbb'
cmt_item['cmt'] = '金刚葫芦娃'
cmt_item['cmt_uid'] = 11
cmt_item['cmt_uname'] = '小水牛'
cmt_item['phone_type'] = '小霸王学习机'
#cmt_item['code'] = '5Y+v54ix55qE5bCP5rC054mbOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
cmt_item['code'] = '54ix6K+t56e75Yqo5byA5Y+R6ICFOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
cmt_item['id'] = 1
cmt_item['uid'] = 1
cmt_item['type'] = 'post_cmt'
params = urllib.urlencode(cmt_item); 
conn.request(method="POST", url=myurl, body=params, headers=headers);
#返回处理后的数据   
response = conn.getresponse(); 
#判断是否提交成功   
print response.status
print json.dumps(json.loads(response.read()), indent = 4)

jiong_item = {}
jiong_item['content'] = 'aaa苍老师和凤姐你想要哪一个?'
jiong_item['type'] = 'post_jiong'
#jiong_item['code'] = '5Y+v54ix55qE5bCP5rC054mbOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
jiong_item['code'] = '54ix6K+t56e75Yqo5byA5Y+R6ICFOjhhYWVlYWVkNDk0NmExZmQxZTBkYmY5MTNmZWUxMDI2'
params = urllib.urlencode(jiong_item); 
conn.request(method="POST", url=myurl, body=params, headers=headers);
#返回处理后的数据   
response = conn.getresponse(); 
#判断是否提交成功   
print response.status
print json.dumps(json.loads(response.read()), indent = 4)

conn.close();
